home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Washington_1988 / Devcon_Extras / HardDisk / scsidisk.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  4.2 KB  |  112 lines

  1. #ifndef    DEVICES_SCSIDISK_H
  2. #define    DEVICES_SCSIDISK_H
  3. /*
  4. **    $Filename: devices/scsidisk.h $
  5. **    $Revision: 1.3 $
  6. **    $Date: 88/10/18 11:19:43 $
  7. **
  8. **    SCSI exec-level device command
  9. **
  10. **    (C) Copyright 1988 Commodore-Amiga, Inc.
  11. **        All Rights Reserved
  12. */
  13.  
  14. /*--------------------------------------------------------------------
  15.  *
  16.  *   SCSI Command
  17.  *    Several Amiga SCSI controller manufacturers are converging on
  18.  *    standard ways to talk to their controllers.  This include
  19.  *    file describes an exec-device command (e.g. for hddisk.device)
  20.  *    that can be used to issue SCSI commands
  21.  *
  22.  *   UNIT NUMBERS
  23.  *    Unit numbers to the OpenDevice call have encoded in them which
  24.  *    SCSI device is being referred to.  The three decimal digits of
  25.  *    the unit number refer to the SCSI Target ID (bus address) in
  26.  *    the 1's digit, the SCSI logical unit (LUN) in the 10's digit,
  27.  *    and the controller board in the 100's digit.
  28.  *
  29.  *    Examples:
  30.  *          0    drive at address 0
  31.  *         12    LUN 1 on multiple drive controller at address 2
  32.  *        104    second controller board, address 4
  33.  *         88    not valid: both logical units and addresses
  34.  *            range from 0..7.
  35.  *
  36.  *   CAVEATS
  37.  *    Original 2090 code did not support this command.
  38.  *
  39.  *    Commodore 2090/2090A unit numbers are different.  The SCSI
  40.  *    logical unit is the 100's digit, and the SCSI Target ID
  41.  *    is a permuted 1's digit: Target ID 0..6 maps to unit 3..9
  42.  *    (7 is reserved for the controller).
  43.  *
  44.  *        Examples:
  45.  *          3    drive at address 0
  46.  *        109    drive at address 6, logical unit 1
  47.  *          1    not valid: this is not a SCSI unit.  Perhaps
  48.  *            it's an ST506 unit.
  49.  *
  50.  *    Some controller boards generate a unique name (e.g. 2090A's
  51.  *    iddisk.device) for the second controller board, instead of
  52.  *    implementing the 100's digit.
  53.  *
  54.  *    There are optional restrictions on the alignment, bus
  55.  *    accessability, and size of the data for the data phase.
  56.  *    Be conservative to work with all manufacturer's controllers.
  57.  *
  58.  *------------------------------------------------------------------*/
  59.  
  60. #define    HD_SCSICMD    28    /* issue a SCSI command to the unit */
  61.                 /* io_Data points to a SCSICmd */
  62.                 /* io_Length is sizeof(struct SCSICmd) */
  63.                 /* io_Actual and io_Offset are not used */
  64.  
  65. struct SCSICmd {
  66.     UWORD  *scsi_Data;        /* word aligned data for SCSI Data Phase */
  67.                 /* (optional) data need not be byte aligned */
  68.                 /* (optional) data need not be bus accessable */
  69.     ULONG   scsi_Length;    /* even length of Data area */
  70.                 /* (optional) data can have odd length */
  71.                 /* (optional) data length can be > 2**24 */
  72.     ULONG   scsi_Actual;    /* actual Data used */
  73.     UBYTE  *scsi_Command;    /* SCSI Command (same options as scsi_Data) */
  74.     UWORD   scsi_CmdLength;    /* length of Command */
  75.     UWORD   scsi_CmdActual;    /* actual Command used */
  76.     UBYTE   scsi_Flags;        /* includes intended data direction */
  77.     UBYTE   scsi_Status;    /* SCSI status of command */
  78.     UBYTE  *scsi_SenseData;    /* sense data: filled if SCSIF_[OLD]AUTOSENSE */
  79.                 /* is set and scsi_Status has CHECK CONDITION */
  80.                 /* (bit 1) set */
  81.     UWORD   scsi_SenseLength;    /* size of scsi_SenseData, also bytes to */
  82.                 /* request w/ SCSIF_AUTOSENSE, must be 4..255 */
  83.     UWORD   scsi_SenseActual;    /* amount actually fetched (0 means no sense) */
  84. };
  85.  
  86.  
  87. /*----- scsi_Flags -----*/
  88. #define    SCSIF_WRITE        0    /* intended data direction is out */
  89. #define    SCSIF_READ        1    /* intended data direction is in */
  90. #define    SCSIB_READ_WRITE    0    /* (the bit to test) */
  91.  
  92. #define    SCSIF_NOSENSE        0    /* no automatic request sense */
  93. #define    SCSIF_AUTOSENSE        2    /* do standard extended request sense */
  94.                     /* on check condition */
  95. #define    SCSIF_OLDAUTOSENSE    6    /* do 4 byte non-extended request */
  96.                     /* sense on check condition */
  97. #define    SCSIB_AUTOSENSE        1    /* (the bit to test) */
  98. #define    SCSIB_OLDAUTOSENSE    2    /* (the bit to test) */
  99.  
  100. /*----- SCSI io_Error values -----*/
  101. #define    HFERR_SelfUnit        40    /* cannot issue SCSI command to self */
  102. #define    HFERR_DMA        41    /* DMA error */
  103. #define    HFERR_Phase        42    /* illegal or unexpected SCSI phase */
  104. #define    HFERR_Parity        43    /* SCSI parity error */
  105. #define    HFERR_SelTimeout    44    /* Select timed out */
  106. #define    HFERR_BadStatus        45    /* status and/or sense error */
  107.  
  108. /*----- OpenDevice io_Error values -----*/
  109. #define    HFERR_NoBoard        50    /* Open failed for non-existant board */
  110.  
  111. #endif    /* DEVICES_SCSIDISK_H */
  112.